package com.yizhubao.app.utils.net;

import com.yizhubao.app.utils.Constants;

import java.io.IOException;

import h.framework.pacy.utils.LogUtil;
import h.framework.pacy.utils.PreferencesUtil;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * 创建人: PACY
 * 创建时间: 6/16/21 1:48 PM
 * 邮箱: pengwwe457621023@qq.com
 * 类描述:
 */
public class SaveCookiesInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request=chain.request();
        Response response=chain.proceed(request);

        String cookie=response.headers().get("set-cookie");
        PreferencesUtil.put("cookie",cookie);
        LogUtil.i("cookie="+cookie);
        return response;
    }
}
